package battlezone;

import javax.media.j3d.*;

public class Tank extends BattlezoneObject {
    private static Configuration _configuration = Configuration.getInstance();
    
    private static Shape3D getNewLiveTankShape() {
        Shape3D shape = new Shape3D(_configuration.getLiveTankGeometry());
        shape.setCapability(Shape3D.ALLOW_GEOMETRY_WRITE);
        return shape;
    }
    
    public Tank(float positionX, float positionY, float azimuth) {
        super(positionX, positionY, azimuth, getNewLiveTankShape());
    }

    /**
     * Changes the tank's model from the live model to the dead model.
     */
    @Override
    public void die() {
        if (_isDead == false) {
            _isDead = true;
            _shape.setGeometry(_configuration.getDeadTankGeometry());
        }
    }
}